import {lazy} from 'react'
import code from '../views/Register/Code/code'

var Index = lazy(()=>import('../views/Ind/Index'))
var Login = lazy(()=>import('../views/Login/login'))
var Register = lazy(()=>import('../views/Register/register'))
var Detail = lazy(()=>import('../views/Detail/detail'))
var City = lazy(()=>import('../views/City/city'))
var NotFound = lazy(()=>import('../views/NotFound/notfound'))

var SearchBox = lazy(()=>import('../views/SearchBox/searchbox'))
var History = lazy(()=>import('../views/SearchBox/History'))
var ManyProduct = lazy(()=>import('../views/SearchBox/ManyProduct'))


var Home = lazy(()=>import('../views/Ind/Home/home'))
var Cate = lazy(()=>import('../views/Ind/Cate/cate'))
var Shopcart = lazy(()=>import('../views/Ind/Shopcart/shopcart'))
var Mine = lazy(()=>import('../views/Ind/Mine/mine'))

var Phone = lazy(()=>import('../views/Register/Phone/phone'))
var Code = lazy(()=>import('../views/Register/Code/code'))
var Pass = lazy(()=>import('../views/Register/Pass/pass'))

//路由配置表
export default [
    {
        path:'/index',
        component: Index,
        children:[
            {
                path:'/index/home',
                component: Home,
            },
            {
                path:'/index/cate',
                component: Cate,
            },
            {
                path:'/index/shopcart',
                component: Shopcart,
            },
            {
                path:'/index/mine',
                component: Mine,
            },
            {
                from:'/index',
                to:'/index/home'
            },
            {
                path:'*',
                component: NotFound,
            },
        ]
    },
    {
        path:'/login',
        component: Login,
    },
    {
        path:'/register',
        component: Register,
        children:[
            {
                path:'/register/phone',
                component: Phone,
            },
            {
                path:'/register/code',
                component: Code,
            },
            {
                path:'/register/pass',
                component: Pass,
            },
        ]
    },
    {
        path:'/detail',
        component: Detail,
    },
    {
        path:'/city',
        component: City,
    },
    {
        path:'/searchbox',
        component: SearchBox,
        children:[
            {
                path:'/searchbox/history',
                component: History,
                exact: true
            },
            {
                path:'/searchbox/manyproduct',
                component: ManyProduct,
                exact: true
            },
            {
                from:'/searchbox',
                to:'/searchbox/history'
            },
            {
                path:'*',
                component: NotFound,
            },
        ]
    },

    {
        from:'/',
        to:'/index'
    },
    {
        path:'*',
        component: NotFound,
    },
]